<template>
  <div class="body">
    <div class="FM">
      <!-- 图标列表 -->
      <div class="icon-list">
        <ul class="icon-firstSide">
          <li v-for="item in list" :key="item.id">
            <div class="icon-firstSideCenter">
              <a><img :src="item.picIPadUrl" alt="" /></a>
              <em>{{ item.name }}</em>
            </div>
          </li>
        </ul>
      </div>
      <!-- 节目列表(推荐节目,节目排行榜) -->
      <div class="program">
        <!-- 推荐节目 -->
        <div class="programLeft">
          <div class="programLeft-title">
            <h3>
              <a href="#">推荐节目</a>
            </h3>
            <a href="#">更多></a>
          </div>
          <ul class="programLeft-list">
            <li class="bg" v-for="item in program" :key="item.id">
              <img class="bgImg" :src="item.blurCoverUrl" />
              <div class="cnt-fn">
                <h3>
                  <a class="bg-list">
                    {{ item.name }}
                  </a>
                </h3>
                <p>
                  <a class="bg-list" style="color: #999999">
                    {{ item.dj.brand }}
                  </a>
                </p>
              </div>
              <a class="endList">
                {{ item.radio.category }}
              </a>
            </li>
          </ul>
        </div>
        <!-- 节目排行榜 -->
        <div class="programRight">
          <div class="programRight-title">
            <h3>
              <a>节目排行榜</a>
            </h3>
            <a>更多></a>
          </div>
          <ul class="programRight-list">
            <li class="bgr" v-for="item in top" :key="item.id">
              <img class="rankFMImg" :src="item.program.coverUrl" />
              <div class="cnt-fnr">
                <h3>
                  <a class="fnrList">{{ item.program.mainSong.name }}</a>
                </h3>
                <p>
                  <a class="fnrList" style="color: #999999">{{
                    item.program.dj.brand
                  }}</a>
                </p>
              </div>
              <span></span>
            </li>
          </ul>
        </div>
      </div>
      <!-- 音乐推荐.电台 -->
      <div class="rdimore">
        <div class="rdimore-title">
          <h3>
            <span>
              <a>音乐推荐</a>
              <span>.</span>
              "电台"
            </span>
          </h3>
          <a class="more">更多></a>
        </div>

        <ul v-for="list in rdimore" :key="list.categoryId">
          <li v-for="item in list.radios" :key="item.id">
            <a>
              <img :src="item.picUrl" />
            </a>
            <div class="rdimoreTitle-list">
              <h3>
                <a>{{ item.name }}</a>
              </h3>
              <p>{{ item.rcmdText }}</p>
            </div>
          </li>
        </ul>
      </div>
      <!-- 生活.电台 -->
      <div class="rdimore">
        <div class="rdimore-title">
          <h3>
            <span>
              <a>音乐推荐</a>
              <span>.</span>
              "电台"
            </span>
          </h3>
          <a class="more">更多></a>
        </div>

        <ul v-for="list in rdimore" :key="list.categoryId">
          <li v-for="item in list.radios" :key="item.id">
            <a>
              <img :src="item.picUrl" />
            </a>
            <div class="rdimoreTitle-list">
              <h3>
                <a>{{ item.name }}</a>
              </h3>
              <p>{{ item.rcmdText }}</p>
            </div>
          </li>
        </ul>
      </div>
      <!-- 情感.电台 -->
      <div class="rdimore">
        <div class="rdimore-title">
          <h3>
            <span>
              <a>音乐推荐</a>
              <span>.</span>
              "电台"
            </span>
          </h3>
          <a class="more">更多></a>
        </div>

        <ul v-for="list in rdimore" :key="list.categoryId">
          <li v-for="item in list.radios" :key="item.id">
            <a>
              <img :src="item.picUrl" />
            </a>
            <div class="rdimoreTitle-list">
              <h3>
                <a>{{ item.name }}</a>
              </h3>
              <p>{{ item.rcmdText }}</p>
            </div>
          </li>
        </ul>
      </div>
      <!-- 创作翻唱.电台 -->
      <div class="rdimore">
        <div class="rdimore-title">
          <h3>
            <span>
              <a>音乐推荐</a>
              <span>.</span>
              "电台"
            </span>
          </h3>
          <a class="more">更多></a>
        </div>

        <ul v-for="list in rdimore" :key="list.categoryId">
          <li v-for="item in list.radios" :key="item.id">
            <a>
              <img :src="item.picUrl" />
            </a>
            <div class="rdimoreTitle-list">
              <h3>
                <a>{{ item.name }}</a>
              </h3>
              <p>{{ item.rcmdText }}</p>
            </div>
          </li>
        </ul>
      </div>
      <!-- 知识.电台 -->
      <div class="rdimore">
        <div class="rdimore-title">
          <h3>
            <span>
              <a>音乐推荐</a>
              <span>.</span>
              "电台"
            </span>
          </h3>
          <a class="more">更多></a>
        </div>

        <ul v-for="list in rdimore" :key="list.categoryId">
          <li v-for="item in list.radios" :key="item.id">
            <a>
              <img :src="item.picUrl" />
            </a>
            <div class="rdimoreTitle-list">
              <h3>
                <a>{{ item.name }}</a>
              </h3>
              <p>{{ item.rcmdText }}</p>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default {
  name: 'FM',
}
</script>

<script lang="ts" setup>
import { ref, reactive, onMounted, nextTick } from 'vue'
import { reqProgramList, reqProgram, reqProgramTop, reqRdimore } from '@/api/fm'
import { log } from 'console'

//图标列表
let list: any = ref([])
onMounted(async () => {
  const result = await reqProgramList()
  console.log(result)
  list.value = result.categories
})

//推荐节目
let program: any = ref([])
onMounted(async () => {
  const result = await reqProgram()
  console.log(result)
  program.value = result.programs
})
//节目排行榜
let top: any = ref([])
onMounted(async () => {
  const result = await reqProgramTop(10)
  console.log(result)
  top.value = result.toplist
})
//节目分类
let rdimore: any = ref([])
onMounted(async () => {
  const result = await reqRdimore()
  console.log(result.data.slice(0, 1))
  rdimore.value = result.data.slice(0, 1)
})
</script>

<style scoped></style>

<style>
.body {
  width: auto;
  height: auto;
  background-color: #f5f5f5;
}
.FM {
  width: 980px;
  height: auto;
  margin: 0 auto;
  background-color: #ffffff;
}
/* 图标列表 */
.icon-list {
  width: 933px;
  height: 194px;
  border: 0px solid red;
  background-color: #ffffff;
  padding-top: 10px;
  margin: 0 auto;
}
.icon-firstSide {
  display: flex;
  flex-wrap: wrap;
}

.icon-firstSide li {
  flex: 0 0 11%;
  text-align: center;
  height: 98px;
  border: 0px solid green;
  padding: 20px 0px 10px 30px;
}
.icon-firstSideCenter {
  margin-left: -20px;
}
.icon-firstSide img {
  display: inline-block;
  /* align-items: flex-start; */
  width: 48px;
  height: 48px;
  filter: grayscale();
}
.icon-firstSide em {
  display: block;
  /* align-items: flex-end; */
  font-size: 12px;
  color: #888888;
}

/* 节目列表(推荐节目,节目排行榜) */
.program {
  width: 933px;
  height: auto;
  margin: 0 auto;
  display: flex;
}
/* 推荐节目 */
.programLeft {
  width: 460px;
  height: auto;
  border: 1px solid green;
}
.programLeft-title {
  display: flex;
  justify-content: space-between;
  width: 420px;
  height: auto;
  border-bottom: 2px solid #c20c0c;
  padding: 50px 0px 5px 0px;
  margin: 0 auto;
}
.programLeft-title h3 a {
  font-size: 24px;
  color: #000000;
}
.programLeft-title a {
  margin-top: 14px;
  font-size: 12px;
  color: #666666;
}
.programLeft-list {
  width: 420px;
  height: auto;
  border: 1px solid yellow;
  margin: 0 auto;
}
.bgImg {
  width: 40px;
  height: 40px;
}
.bg {
  display: flex;
  padding: 0px 0px 10px 20px;
}
.bg:nth-child(even) {
  background-color: #f7f7f7;
}
.cnt-fn {
  width: 250px;
  margin-left: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cnt-fn a {
  font-size: 12px;
}
.endList {
  display: inline-block;
  position: relative;
  top: 10px;
  left: 20px;
  height: 16px;
  overflow: hidden;
  padding: 0 6px;
  border: 1px solid #999;
  line-height: 16px;
  color: #999999;
  vertical-align: middle;
  font-size: 12px;
}
/* 节目排行榜 */
.programRight {
  width: 460px;
  height: auto;
  border: 1px solid green;
}
.programRight-title {
  display: flex;
  justify-content: space-between;
  width: 420px;
  height: auto;
  border-bottom: 2px solid #c20c0c;
  padding: 50px 0px 5px 0px;
  margin: 0 auto;
}
.programRight-title h3 a {
  font-size: 24px;
  color: #000000;
}
.programRight-title a {
  margin-top: 14px;
  font-size: 12px;
  color: #666666;
}
.rankFMImg {
  width: 40px;
  height: 40px;
}
.programRight-list {
  width: 420px;
  height: auto;
  border: 1px solid yellow;
  margin: 0 auto;
}
.bgr {
  display: flex;
  padding: 0px 0px 10px 20px;
}
.bgr:nth-child(even) {
  background-color: #f7f7f7;
}
.cnt-fnr {
  width: 250px;
  margin-left: 10px;
}
.fnrList {
  font-size: 12px;
}

/* 电台的分类推荐 */
.rdimore {
  width: 900px;
  height: auto;
  border: 1px solid red;
  margin-top: 5px;
  margin: 0 auto;
}
.rdimore-title {
  display: flex;
  justify-content: space-between;
  width: 900px;
  height: auto;
  border-bottom: 2px solid #c20c0c;
  padding: 0px 0px 10px 0px;
  margin: 0 auto;
}
.rdimore-title h3 {
  font-size: 24px;
  color: #000000;
}
.more {
  margin-top: 14px;
  font-size: 12px;
  color: #666666;
}
.rdimore ul {
  display: flex;
  flex-wrap: wrap;
}
.rdimore li {
  display: flex;
  flex: 0 0 50%;
  flex-direction: row;
  margin: 20px 0 20px 0;
}
.rdimore img {
  width: 120px;
  height: 120px;
}
.rdimoreTitle-list {
  margin: 30px 0 0 20px;
  white-space: nowrap;
}
.rdimoreTitle-list a {
  font-weight: bold;
  font-size: 18px;
  color: #333333;
}
.rdimoreTitle-list p {
  margin-top: 10px;
  font-size: 12px;
  color: #999999;
}
</style>
